/**
 *    Copyright 2009-2015 the original author or authors.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package org.apache.ibatis.reflection.invoker;

import java.lang.reflect.InvocationTargetException;

/**
 * 执行器接口，主要是为了统一getter方法、setter方法和Field个get和set执行时的差异，使用了对象的适配器模式。</br>
 * 	实现类：</br>
 * 	{@link MethodInvoker} getter或setter方法执行器</br>
 * 	{@link GetFieldInvoker} get属性执行器</br>
 * 	{@link SetFieldInvoker} set属性执行器</br>
 * @author Clinton Begin
 */
public interface Invoker {
	/**
	 * 执行调用
     * 主要用于执行：getter方法、setter方法和Field的get和set
	 * @param target
	 * @param args
	 * @return
	 * @throws IllegalAccessException
	 * @throws InvocationTargetException
	 */
  Object invoke(Object target, Object[] args) throws IllegalAccessException, InvocationTargetException;
  /**
   * 差异：
   * 1.getter方法 返回返回类型
   * 2.setter方法 返回参数类型
   * 3.Field返回自身的类型
   * @return
   */
  Class<?> getType();
}
